$(function () {
    $('.btn').click(function () {
        let username = $('#username').val();
        let password = $('#password').val();
        if (username == '' || username.sizes < 0 || password == '') {
            alert("用户名或密码不能为空！");
        } else {
            loginCheck();
        }
    });

    function loginCheck() {
        $.ajax({
            type: "POST",
            url: 'user/login.action',
            data: $('.form-horizontal').serialize(),
            success: function (data) {
                if (data.success)
                    window.location.href = "frontReportRecord";
                else {
                    alert(data.errMsg);
                }
            },
            error: function(data) {
            }
        });
    }
})